<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8,chrome=1" />
    <meta name="renderer" content=" webkit">
    <link rel="stylesheet" type="text/css" href="/www/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/www/css/main.css">
    <script type="text/javascript" src="/www/js/jquery.1.11.2.min.js"></script>
    <script type="text/javascript" src="/www/js/main.js"></script>
</head>

<body>
    <div class="header clear">
        <div class="t fl">后台管理</div>
        <a class="login_out fr" title="退出" href="/admin/logOut"><span class="icon"></span>退出</a>
        <span class="login_out fr">
            欢迎，<em class="user">{{userInfo.username}}</em>
            {% if userInfo.isAdmin %}
                管理员
            {% endif %}
        </span>
    </div>
    <div class="main">
        <div class="h60"></div>
        <!-- main_left star -->
        <div class="main_left">
            <div class="h90"></div>
            <div class="menu"><a href="/admin"><span class="icon home_ico"></span>后台主页</a></div>
            <div class="menu"><a href="/admin/article"><span class="icon management_ico"></span>文章管理</a></div>
            <div class="menu"><a href="/admin/tag"><span class="icon data_ico"></span>标签管理</a></div>
            <div class="menu"><a href="/admin/users"><span class="icon tool_ico"></span>用户管理</a></div>
            <div class="menu"><a href="/admin/menu"><span class="icon tool_ico"></span>菜单管理</a></div>
            <div class="menu"><a href="/admin/settings"><span class="icon account_ico"></span>设置</a></div>
        </div>
        <!-- main_left end -->
        
        <!-- main_right star -->
        <div class="main_right">
            {% if title %}
            <div class="main_r_t">
                <h3 class="title_h3">{{ title }}</h3>
            </div>
            {% endif%}

            <div class="main_content">
                <div class="main_m">
                    {% block main %}{% endblock %}
                </div>
            </div>
        </div>
        <!-- main_right end -->
    </div>
</body>

<script type="text/javascript">

function menu(){

    var url = location.pathname;

    if(url.indexOf('/admin') >= 0 && url == '/admin'){

        $(".main_left .menu").eq(0).find('a').addClass('active');

    }else if (url.indexOf('/admin/article') >= 0 ) {

        $(".main_left .menu").eq(1).find('a').addClass('active');

    }else if (url.indexOf('/admin/tag') >= 0) {

        $(".main_left .menu").eq(2).find('a').addClass('active');

    }else if (url.indexOf('/admin/users') >= 0 ) {

        $(".main_left .menu").eq(3).find('a').addClass('active');

    }else if (url.indexOf('/admin/menu') >= 0 ) {

        $(".main_left .menu").eq(4).find('a').addClass('active');

    }else if (url.indexOf('/admin/settings') >= 0){

        $(".main_left .menu").eq(5).find('a').addClass('active');
        
    }
    console.log(location.pathname)
}
menu()

</script>

</html>
